//
//  TCMyTableViewCell.m
//  Project_B
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 张闯. All rights reserved.
//

#import "TCMyTableViewCell.h"
#import "UIImageView+WebCache.h"
#define WIDTH [[UIScreen mainScreen] bounds].size.width / 375
#define HEIGHT [[UIScreen mainScreen] bounds].size.height / 667
@interface TCMyTableViewCell ()
@property (nonatomic, strong)UILabel *timelabel;
@property (nonatomic, strong)UILabel *typelabel;
@property (nonatomic, strong)UILabel *titlelabel;
@property (nonatomic, strong)UIImageView *bigimage;
@property (nonatomic, strong)UIImageView *smallimage;
@end
@implementation TCMyTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.bigimage = [[UIImageView alloc]init];
//        self.bigimage.layer.borderWidth = 2;
//        self.bigimage.layer.borderColor = [UIColor colorWithRed:60.0 / 255 green:149.0 / 255 blue:58.0 / 255 alpha:1].CGColor;
        [self.contentView addSubview:self.bigimage];
        
        self.smallimage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.smallimage];
        
        self.timelabel = [[UILabel alloc]init];
        [self.timelabel setFont:[UIFont systemFontOfSize:15]];
        [self.timelabel setTextColor:[UIColor whiteColor]];
        self.timelabel.shadowColor = [UIColor grayColor];
        self.timelabel.shadowOffset = CGSizeMake(1.5, 1.5);
        [self.contentView addSubview:self.timelabel];
        
        self.typelabel = [[UILabel alloc]init];
        [self.typelabel setFont:[UIFont boldSystemFontOfSize:14]];
        self.typelabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.typelabel];
        
        self.titlelabel = [[UILabel alloc]init];
        [self.titlelabel setFont:[UIFont systemFontOfSize:13.5]];
        self.titlelabel.textColor = [UIColor grayColor];
        self.titlelabel.numberOfLines = 0;
        [self.contentView addSubview:self.titlelabel];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.bigimage.frame = CGRectMake(10*WIDTH, 10*HEIGHT, (375-20)*WIDTH, 150*HEIGHT);
    self.smallimage.frame = CGRectMake(333*HEIGHT, 128*HEIGHT, 30*WIDTH, 30*HEIGHT);
    self.timelabel.frame = CGRectMake(15*WIDTH, 15*HEIGHT, 240*WIDTH, 30*HEIGHT);
    self.titlelabel.frame = CGRectMake(15*WIDTH, 158*HEIGHT, 300*WIDTH, 40*HEIGHT);
    self.typelabel.frame = CGRectMake(15*WIDTH, 40*HEIGHT, 240*WIDTH, 30*HEIGHT);
}

- (void)setTemp:(TCRoute *)temp
{
    if (self.temp != temp) {
        _temp = temp;
    }
    [self.bigimage sd_setImageWithURL:[NSURL URLWithString:temp.image] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    [self.smallimage sd_setImageWithURL:[NSURL URLWithString:temp.club_img] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.timelabel.text = temp.times;
    self.titlelabel.text = temp.title;
    self.typelabel.text = [NSString stringWithFormat:@"活动类型:%@",temp.catename];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
